<template>
  <div class="app-container">
    <!-- 车辆违章 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="运输公司" prop="cityCode">
        <el-select v-model="queryParams.violationCompanyId" clearable  placeholder="请选择运输公司" @change="formTranCompanyChange">
          <el-option
            v-for="(v,index) in tranCompanyList"
            :key="index"
            :label="v.name"
            :value="v.oldTeamId"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="车辆" prop="cityCode">
        <el-select v-model="queryParams.vehiceId" clearable  placeholder="请选择车辆列表" @change="formViolationVehicleChange">
          <el-option
            v-for="(v,index) in vehicleinfoList"
            :key="index"
            :label="v.plate"
            :value="v.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="审核状态" prop="auditStatus">
        <el-select v-model="queryParams.auditStatus" clearable  placeholder="请选择审核状态" >
          <el-option
            v-for="(v,index) in dict.type.normal_audit_status"
            :key="index"
            :label="v.label"
            :value="v.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="是否阅读" prop="isRead">
        <el-select v-model="queryParams.isRead" clearable  placeholder="请选择" >
          <el-option label="已读" value="1"></el-option>
          <el-option label="未读" value="0"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="是否处理" prop="isHandle">
        <el-select v-model="queryParams.isHandle" clearable  placeholder="请选择" >
          <el-option label="已处理" value="1"></el-option>
          <el-option label="未处理" value="0"></el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="违章时间" prop="violationTime">
        <el-date-picker clearable
          v-model="queryParams.violationTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择违章时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="处罚时间" prop="penaltyTime">
        <el-date-picker clearable
          v-model="queryParams.penaltyTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择处罚时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['violation:vehicle:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['violation:vehicle:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['violation:vehicle:remove']"
        >删除</el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['violation:vehicle:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table border fit highlight-current-row empty-text="暂无数据" v-loading="loading" :data="vehicleList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column label="序号" align="center" prop="id" /> -->
      <el-table-column label="运输公司" align="center" prop="transCompanyName" width="200" />
      <el-table-column label="车牌号" align="center" prop="vehiceCode" width="150" />
      <el-table-column label="违章行为类型" align="center" prop="violationType" width="200" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.vehicle_violation_type" :value="scope.row.violationType"/>
        </template>
      </el-table-column>
      <!--      <el-table-column label="标记处理意见ID" align="center" prop="resolutionId" />-->
      <el-table-column label="违章说明备注" align="center" prop="remark" width="120"  />
      <el-table-column label="违章地点" align="center" prop="areaAddress" width="150"  />
      <el-table-column label="执法人员姓名" align="center" prop="lawerUserName" width="100" />
      <!-- <el-table-column label="执法人员姓名" align="center" prop="lawUserName" /> -->
      <!--      <el-table-column label="是否阅读，0-未读，1-已读" align="center" prop="isRead" >-->
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.read_status" :value="scope.row.isRead"/>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
      <el-table-column label="违章金额" align="center" prop="violationAmount">
        <template slot-scope="scope" v-if="scope.row.violationAmount">
          ￥{{scope.row.violationAmount}}
        </template>
      </el-table-column>
      <el-table-column label="违章时间" align="center" prop="violationTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.violationTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="违章条例" align="center" prop="regulationsTitle" width="200" :show-overflow-tooltip="true"/>
      <!-- <el-table-column label="是否处理" align="center" prop="isHandle" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.handle_status" :value="scope.row.isHandle"/>
        </template>
      </el-table-column> -->
      <el-table-column label="审核不通过原因" align="center" prop="auditReason" width="120" />
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['violation:vehicle:edit']"
          >修改</el-button> -->
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['violation:vehicle:remove']"
          >删除</el-button> -->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleDesc(scope.row)"
            v-hasPermi="['modules:company:query']"
          >详情</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-document-checked"
            @click="handleAudit(scope.row)"
            v-if="scope.row.auditStatus==0"
            v-hasPermi="['violation:vehicle:audit']"
          >审核</el-button>
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-document-checked"
            @click="handleCorrection(scope.row)"
            v-if="scope.row.auditStatus==1"
            v-hasPermi="['violation:vehicle:correct']"
          >整改</el-button> -->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改车辆违章上报信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" class="fillUpForm" label-width="120px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="运输公司" prop="violationCompanyId">
              <el-input v-if="title == descTitle && form.transCompanyName" :disabled="title == descTitle" v-model="form.transCompanyName" />
              <el-select v-else :disabled="title == descTitle" v-model="form.violationCompanyId" clearable  :placeholder="title == descTitl?'':'请选择运输公司'" @change="formTranCompanyChange1">
                <el-option
                  v-for="(v,index) in tranCompanyList"
                  :key="index"
                  :label="v.name"
                  :value="v.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="车辆" prop="vehiceId">
              <el-input v-if="title == descTitle && form.vehiceCode" :disabled="title == descTitle" v-model="form.vehiceCode" />
              <el-select v-else :disabled="title == descTitle" v-model="form.vehiceId" clearable  :placeholder="title == descTitl?'':'请选择车辆列表'">
                <el-option
                  v-for="(v,index) in vehicleinfoList"
                  :key="index"
                  :label="v.plate"
                  :value="v.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="违章行为" prop="violationType">
              <el-select :disabled="title == descTitle" v-model="form.violationType" clearable  :placeholder="title == descTitl?'':'请选择违章行为'">
                <el-option
                  v-for="(v,index) in dict.type.vehicle_violation_type"
                  :key="index"
                  :label="v.label"
                  :value="v.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="违章条例" prop="resolutionId">
              <el-input v-if="form.regulationConfig" :disabled="title == descTitle" v-model="form.regulationConfig.regulationsTitle" :placeholder="title == descTitl?'':'请输入违章地点'" />
              <el-select v-else :disabled="title == descTitle" v-model="form.resolutionId" clearable  :placeholder="title == descTitl?'':'请选择违章条例'">
                <el-option
                  v-for="(v,index) in regulationList"
                  :key="index"
                  :label="v.regulationsTitle"
                  :value="v.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
            <el-form-item label="违章区域" prop="areaAddress">
              <el-input :disabled="title == descTitle" v-model="form.areaAddress"  placeholder="请输入区域地址" />
            </el-form-item>
          </el-col> -->
          <el-col :span="8">
            <el-form-item label="违章地点" prop="address">
              <el-input :disabled="title == descTitle" v-model="form.areaAddress" :placeholder="title == descTitl?'':'请输入违章地点'" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="执法人员姓名" prop="lawerUserName">
              <el-input :disabled="title == descTitle" v-model="form.lawerUserName" :placeholder="title == descTitl?'':'请输入执法人员姓名'" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="经度" prop="lat">
              <el-input v-model="form.lat" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="纬度" prop="lon">
              <el-input v-model="form.lon" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="违章金额" prop="violationAmount">
              <el-input :disabled="title == descTitle" v-model="form.violationAmount" :placeholder="title == descTitl?'':'请输入违章金额'" type = "number" step = "0.1"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="违章说明备注" prop="remark">
              <el-input :disabled="title == descTitle" v-model="form.remark" type="textarea" :placeholder="title == descTitl?'':'请输入内容'" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="违章时间" prop="violationTime">
              <el-date-picker :disabled="title == descTitle" clearable
                v-model="form.violationTime"
                type="date"
                value-format="yyyy-MM-dd"
                :placeholder="title == descTitl?'':'请选择违章时间'">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="处罚时间" prop="penaltyTime">
              <el-date-picker :disabled="title == descTitle" clearable
                v-model="form.penaltyTime"
                type="date"
                value-format="yyyy-MM-dd"
                :placeholder="title == descTitl?'':'请选择处罚时间'">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          
<!--        <el-form-item label="整改现场照片" prop="handleImgUrl">-->
<!--          <el-input v-model="form.handleImgUrl" placeholder="请输入整改现场照片" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="整改说明">-->
<!--          <editor v-model="form.handleContent" :min-height="192"/>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="工地负责单位ID" prop="construtionUnitId">-->
<!--          <el-input v-model="form.construtionUnitId" placeholder="请输入工地负责单位ID" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="执法人员ID" prop="lawerUserId">-->
<!--          <el-input v-model="form.lawerUserId" placeholder="请输入执法人员ID" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="审核不通过原因" prop="auditReason">-->
<!--          <el-input v-model="form.auditReason" placeholder="请输入审核不通过原因" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="执法人员姓名" prop="lawerUserName">-->
<!--          <el-input v-model="form.lawerUserName" placeholder="请输入执法人员姓名" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="审核人员ID" prop="auditUserId">-->
<!--          <el-input v-model="form.auditUserId" placeholder="请输入审核人员ID" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="违章金额" prop="violationAmount">-->
<!--          <el-input v-model="form.violationAmount" placeholder="请输入违章金额" />-->
<!--        </el-form-item>-->

          
          <el-col :span="24">
            <el-form-item label="现场图片" prop="imageUrl">
              <image-upload v-if="title != descTitle" v-model="form.imageUrl"/>
              <div v-if="title == descTitle" style="width: 100%; display: flex;">
                <div style="display: inline-block; margin: 0 8px 8px 0; border: 1px solid #c0ccda; border-radius: 6px;" v-for="(item, i) in form.imageUrl" :key="i">
                  <el-image
                    @click="handlePictureCardPreview(item)"
                    style="width: 150px; height: 150px"
                    :src="item.url"
                    fit="cover"></el-image>
                </div>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="现场视频" prop="videoUrl">
              <file-upload v-if="title != descTitle" v-model="form.videoUrl"/>
              <el-video v-if="form.videoUrl && title != descTitle"
                        :src="form.videoUrl"
                        :autoplay="false"
                        :loop="false"
                        :controls="true"
                        width="640"
                        height="360"
              ></el-video>
              
              <video v-if="title == descTitle && form.videoUrl" width="320" height="240" controls>
                <source :src="form.videoUrl" type="video/mp4" />
              </video>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button v-if="title != descTitle" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    
    <!-- 添加或修改车辆违章上报信息对话框 -->
    <el-dialog title="违章审核" :visible.sync="auditOpen" width="500px" append-to-body>
      <el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="80px">
        <el-form-item label="审核状态" prop="auditStatus">
          <el-select v-model="auditForm.auditStatus" clearable placeholder="请选择审核状态">
            <!--            <el-option-->
            <!--              v-for="(v,index) in dict.type.normal_audit_status"-->
            <!--              :key="index"-->
            <!--              :label="v.label"-->
            <!--              :value="v.value"-->
            <!--            ></el-option>-->
            <el-option label="审核通过" value="2"></el-option>
            <el-option label="审核不通过" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="审核说明" prop="auditReason">
          <el-input v-model="auditForm.auditReason" type="textarea" placeholder="请输入审核说明" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleAuditProject">确 定</el-button>
        <el-button @click="cancelAudit">取 消</el-button>
      </div>
    </el-dialog>

    
    <el-dialog
      :visible.sync="dialogVisible"
      title="预览"
      width="800"
      append-to-body
    >
      <img
        :src="dialogImageUrl"
        style="display: block; max-width: 100%; margin: 0 auto"
      />
    </el-dialog>
  </div>
</template>

<script>
import { listVehicle, getVehicle, delVehicle, addVehicle, updateVehicle ,pageVehicle} from "@/api/violation/vehicle";
import { listTransportationCompany, getTransportationCompany, delTransportationCompany, addTransportationCompany, updateTransportationCompany } from "@/api/modules/transportationCompany";
import {listRegulation} from '@/api/manger/regulation'
import { listVehicleinfo, getVehicleinfo, delVehicleinfo, addVehicleinfo, updateVehicleinfo } from "@/api/manger/vehicleinfo";

export default {
  name: "Vehicle",
  dicts: ['normal_audit_status','read_status','handle_status','vehicle_violation_type'],
  data() {
    return {
      //运输公司列表
      tranCompanyList:[],
      vehicleList:[],
      vehicleinfoList:[],
      regulationList:[],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 车辆违章上报信息表格数据
      vehicleViolationList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        vehiceId: null,
        vehiceViolationId: null,
        resolutionId: null,
        violationType: null,
        violationCompanyId: null,
        vehiceCode: null,
        provinceCode: null,
        provinceName: null,
        cityCode: null,
        cityName: null,
        areaCode: null,
        areaName: null,
        townName: null,
        townCode: null,
        imageUrl: null,
        videoUrl: null,
        auditStatus: null,
        address: null,
        isRead: null,
        isHandle: null,
        status: null,
        handleImgUrl: null,
        handleContent: null,
        construtionUnitId: null,
        lawerUserId: null,
        auditReason: null,
        lawerUserName: null,
        auditUserId: null,
        violationAmount: null,
        violationTime: null,
        penaltyTime: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        violationCompanyId: [
          { required: true, message: "运输公司不能为空", trigger: "blur" }
        ],
        violationType: [
          { required: true, message: "违章行为不能为空", trigger: "change" }
        ],
        // resolutionId: [
        //   { required: true, message: "违章条例不能为空", trigger: "change" }
        // ],
      },
      descTitle: '查看车辆违章上报信息', // 详情标题

      dialogImageUrl: '',
      dialogVisible: false,

      // 审核
      auditOpen: false,
      auditForm: {
        id: null,
        reason: null,
        auditStatus: null
      },
      auditRules: {
        auditStatus: [
          { required: true, message: "请选择审核状态", trigger: "blur" }
        ],
        id: [
          { required: true, message: "审核数据编号不能为空", trigger: "blur" }
        ]
      },
    };
  },
  created() {
    this.getList();
    this.initTranCompanyList();
    this.initRegulationList();
  },
  methods: {
    formTranCompanyChange(v){
        this.initVehicleList(v)
    },
    formTranCompanyChange1(v){
      this.initVehicleList(v)
    },
    initTranCompanyList(){
      this.loading = true;
      listTransportationCompany().then(response => {
        this.tranCompanyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    initVehicleList(v){
      listVehicleinfo({teamId:v}).then(response => {
        this.vehicleinfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    initRegulationList(){
      listRegulation({type:0,status:0}).then(response => {
        this.regulationList = response.data;
      })
    },
    /** 查询车辆违章上报信息列表 */
    getList() {
      this.loading = true;
      pageVehicle(this.queryParams).then(response => {
        this.vehicleList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        vehiceId: null,
        vehiceViolationId: null,
        resolutionId: null,
        violationType: null,
        violationCompanyId: null,
        vehiceCode: null,
        provinceCode: null,
        provinceName: null,
        cityCode: null,
        cityName: null,
        areaCode: null,
        areaName: null,
        townName: null,
        townCode: null,
        imageUrl: null,
        videoUrl: null,
        auditStatus: null,
        remark: null,
        address: null,
        isRead: null,
        isHandle: null,
        status: null,
        createTime: null,
        updateTime: null,
        handleImgUrl: null,
        handleContent: null,
        construtionUnitId: null,
        lawerUserId: null,
        auditReason: null,
        lawerUserName: null,
        auditUserId: null,
        violationAmount: null,
        violationTime: null,
        penaltyTime: null,
        reportNumber:null,
        lat:null,
        lon:null,
        areaAddress:null,
        transCompanyName:null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加车辆违章上报信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getVehicle(id).then(response => {
        this.form = response.data;
        this.form.violationType = String(this.form.violationType)
        this.open = true;
        this.title = "修改车辆违章上报信息";
      });
    },
    /** 查询按钮操作 */
    handleDesc(row) {
      this.reset();
      const id = row.id || this.ids
      getVehicle(id).then(response => {
        this.form = response.data;
        this.form.violationType = String(this.form.violationType)

        
        let baseUploadUrl = process.env.VUE_APP_BASE_API
        // let baseUploadUrl = 'http://192.168.31.156:8808/'
        let getLast = baseUploadUrl[baseUploadUrl.length-1]
        console.log(getLast)
        if(getLast == '/'){
          baseUploadUrl = baseUploadUrl.slice(0, -1)
        }
        console.log(baseUploadUrl, 'baseUploadUrl')

        
        // 处理图片
        if(this.form.imageUrl){
           // 首先将值转为数组
           let list = Array.isArray(this.form.imageUrl) ? this.form.imageUrl : this.form.imageUrl.split(',');
          // 然后将数组转为对象数组
          let imgList = []
          imgList = list.map(item => {
            if (typeof item === "string") {
              if (item.indexOf('http') === -1) {
                  item = { name: item, url: baseUploadUrl + item };
              } else {
                  item = { name: item, url: item };
              }
            }
            return item;
          });
          this.form.imageUrl = imgList
        }
        // 处理视频链接
        if(this.form.videoUrl){
          // this.form.videoUrl = process.env.VUE_APP_BASE_API + this.form.videoUrl
          this.form.videoUrl = baseUploadUrl + this.form.videoUrl
        }


        this.open = true;
        this.title = this.descTitle;
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateVehicle(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addVehicle(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除车辆违章上报信息编号为"' + ids + '"的数据项？').then(function() {
        return delVehicle(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('violation/vehicle/export', {
        ...this.queryParams
      }, `vehicle_${new Date().getTime()}.xlsx`)
    },

    // 选择车辆列表
    formViolationVehicleChange() {

    },

    
    // 预览
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },

    // 审核
    handleAuditProject() {
      this.$refs["auditForm"].validate(valid => {
        if (valid) {
          if (this.auditForm.id != null) {
            // auditProject(this.auditForm).then(response => {
            //   this.$modal.msgSuccess("审核完成");
            //   this.auditOpen = false;
            //   this.getList();
            // });
            updateVehicle(this.auditForm).then(response => {
              this.$modal.msgSuccess("审核完成");
              this.auditOpen = false;
              this.getList();
            });
          }
        }
      });
    },
    cancelAudit() {
      this.auditForm.id = null;
      this.auditOpen = false;
    },
    handleAudit(row) {
      this.auditForm = row;
      this.auditForm.auditStatus = ''
      this.auditOpen = true;
    },
  }
};
</script>

<style lang="scss" scoped>
  
  .fillUpForm {
    .el-input{
      width: 100%;
    }
    .el-select{
      width: 100%;
    }
  }

</style>